package com.etime.perfectschool.service.impl;

import com.etime.perfectschool.mapper.NewsCommentsMapper;
import com.etime.perfectschool.pojo.NewsComments;
import com.etime.perfectschool.service.NewsCommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsCommentsServiceImpl implements NewsCommentsService {

    @Autowired
    private NewsCommentsMapper newsCommentsMapper;

    @Override
    public List<NewsComments> getAllNewsComments(int newId) {
        return newsCommentsMapper.getAllNewsComments(newId);
    }

    @Override
    public int addNewsComments(NewsComments newsComments) {
        return newsCommentsMapper.insert(newsComments);
    }

    @Override
    public int deleteNewsComments(int newsCommentsId) {
        return newsCommentsMapper.deleteById(newsCommentsId);
    }

    @Override
    public boolean deleteNewsCommentsBynewId(int newsId) {
        return newsCommentsMapper.deleteNewsCommentsBynewId(newsId)==0?false:true;
    }
}
